import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
//GestureDetector手势操作是开发中必不可少的，Flutter中的GestureDetector一共有 7大类25种。
/**
Tap：
    onTapDown: (details) {},
    onTapUp: (details) {},
    onTap: () {},
    onTapCancel: () {},
双击:
    onDoubleTap: () {},
长按：
    onLongPress: () {},
    onLongPressStart: () {},
    onLongPressMoveUpdate: () {},
    onLongPressUp: () {},
    onLongPressEnd: () {},
垂直滑动：
    onVerticalDragDown: (details) {},
    onVerticalDragStart: (details) {},
    onVerticalDragUpdate: (details) {},
    onVerticalDragEnd: (details) {},
    onVerticalDragCancel: () {},
水平滑动：
    onHorizontalDragDown: (details) {},
    onHorizontalDragStart: (details) {},
    onHorizontalDragUpdate: (details) {},
    onHorizontalDragEnd: (details) {},
    onHorizontalDragCancel: () {},
Pan事件：
    指针已接触屏幕并可能开始移动。
    onPanDown: (details) {},
    指针已经接触屏幕并开始移动。
    onPanStart: (details) {},
    与屏幕接触并移动的指针再次移动。
    onPanUpdate: (details) {},
    先前与屏幕接触并移动的指针不再与屏幕接触，并且当它停止接触屏幕时以特定速度移动。
    onPanEnd: (details) {},
    先前触发 onPanDown 的指针未完成。
    onPanCancel: () {},
Scale事件：
    onScaleStart: (details) {},
    onScaleUpdate: (details) {},
    onScaleEnd: (details) {},
     */
class BaseGestureDemo extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return Scaffold(

      appBar: AppBar(
        title: Text('手势处理'),
        centerTitle: true,
      ),
      body: GestureDetector(
        onTap: (){
          print('点击');
          ScaffoldMessenger.of(context)
              .showSnackBar(SnackBar(content: Text('点击按钮')));
        },
        child: Container(
          padding: EdgeInsets.all(15),
          margin: EdgeInsets.symmetric(horizontal: 15,vertical: 15),
          decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(5),
              color: Colors.yellow
          ),
          child: Text('点击测试'),
        ),
      ),
    );
  }
}

void main(){
  runApp(MaterialApp(
    title: '手势处理',
    home: BaseGestureDemo(),
  ));
}